home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 12.5 KB | 335 lines | [TEXT/MPS ] |
- #########################################################################
- #########################################################################
- ## Copyright © Apple Computer, Inc. 1993-1997
- ## All rights reserved
- #########################################################################
- #########################################################################
- #
- # Library: Dev Launchquits
- #
- # Version: 2.1.4
- # Description: This library is used for developing new Launchquit test
- # defs. To use it you must make it modifiable. Select the
- # text on the line below starting with Commando (not the ##),
- # hit the enter key, click 'Files to write enable…', select
- # this file in the dialog provided, click the Done button,
- # then press enter again. The write protect indicator for
- # this file (a pencil in the upper left corner of the window)
- # should have a dotted line through it, or no line, showing
- # you can now change the file.
- #
- # Commando ModifyReadOnly ∑∑ Dev:Null
- # Contains:
- # GetDevLaunchQuitTD()
- #
- # History:
- # Date: By: Changes:
- # 05/19/93 SBR Created
- # 03/21/94 SBR Changed to new lookup task, added instructions.
- # 07/30/95 SBR Changes to GetDevLaunchQuitTC.
- # 01/30/97 SBR Deleted older exception code and comments.
- # 01/31/97 SBR Changed from GetDevLaunchQuitTC to GetDevLaunchQuitTD.
- #########################################################################
- #########################################################################
-
- Libraries "Report.lib";
-
- ##############################################################################################
- # task GetDevLaunchQuitTD(v_level)
- #=============================================================================================
- # Description: This task is a substitute test def lookup task for developing Launchquit
- # test defs. The only service it provides is "nextTD", so if you want to
- # execute a subset of the test defs you create you must comment them out
- # manually. Add the new test defs by duplicating the sample along with its
- # Setup line, removing the comment symbol (#) and replacing the old data
- # with the new. You can add as many test defs as you want.
- # Parameters: v_level
- # Returns: a Launchquit test def
- # Examples: theTestDef := GetDevLaunchQuitTD();
- # Assumptions: none
- #=============================================================================================
- # History:
- # Date: By: Changes:
- # 04/12/92 SBR Created
- # 05/27/93 SBR Changed 'creatorDupe' to 'noCreatorLaunch'
- # 05/29/93 SBR Created this file from AIQ LaunchQuits to make development easier
- # 03/01/94 SBR Rewrote GetDevLaunchQuitTC() for most recent lookup task parameters
- # Currently it supports ONLY the "nextTD" lookup method.
- # 07/30/95 SBR Converts *all* partialName values (lookup methods) to "nextTD".
- # GetDevLaunchQuitTC() sets global gDevelopmentMode to true.
- # GetDevLaunchQuitTC() prints status when a test def is found.
- # 01/31/97 SBR Changed GetDevLaunchQuitTC to GetDevLaunchQuitTD.
- ##############################################################################################
- task GetDevLaunchQuitTD(partialName := "nextTD", appParameters := {}, resetTDHistory := false,
- v_level := 4)
- begin
- global gDevTDList, gCardDevTDList, gPreviousTD, gDevelopmentMode;
-
- gDevelopmentMode := true;
-
- partialName := "nextTD"; # we only do "nextTD"
-
- if isUndefined(gDevTDList) or resetTDHistory
- begin
- gDevTDList :=
- {
-
- (*Setup: none.*)
- # {1,"SampleApp@", "SAMP", "SampleAppƒ", {}, {}, {} },
-
- {1,"Nisus Writer 4.0@","NISI","Nisus Writer 4.0ƒ",{'SNConflict'},
- {{[staticText t:/The registration number≈/ w:1],[button t:'OK'],
- [staticText t:'Registration Number:' w:1],{'type_keys',{'6264962766921',returnKey}}},''},
- {[menuItem t:'Quit' m:2 k:'q'],{'key_eq','q'},{[application t:'Nisus Writer 4.0@'],'>'},''} },
-
-
- {} ### DO NOT REMOVE THIS TEST DEF; IT MUST BE LAST *AND* EMPTY!!!
-
- };
-
- gPreviousTD := 0;
- gCardDevTDList := card gDevTDList;
- end;
-
- if partialName = "nextTD" # we prefer "nextTD"
- begin
- gPreviousTD := gPreviousTD + 1;
- return gDevTDList[gPreviousTD];
- end;
- else
- begin
- RStatus("GetDevLaunchQuitTD({partialName},{appParameters},{resetTDHistory},{v_level})",v_level);
- return {};
- end;
- end;
-
-
- # 08/01/95 SBR: UNDER CONSTRUCTION, TRYING TO MAKE DEV LAUNCHQUITS DO "randomDeal" AND "by name"
- # LOOKUPS INSTEAD OF JUST "nextTD"...
- #
- # task GetDevLaunchQuitTD(partialName := "nextTD", appParameters := {}, resetTDHistory := false,
- # v_level := 4)
- # begin
- # global gDevTDList, gCardDevTDList, gPreviousTD, gDevelopmentMode, gDevLQTDHistory;
- #
- # if resetTDHistory
- # begin
- # if typeOf (resetTDHistory) = "list"
- # gDevLQTDHistory := resetTDHistory;
- # else
- # gDevLQTDHistory := {{0,0},{}};
- # end;
- # else
- # begin
- # if not gDevLQTDHistory
- # gDevLQTDHistory := {{0,0},{}};
- # end;
- #
- # theTestDef := { }; #default value in case we can not find a good one
- #
- # if partialName ~= /random≈/
- # begin
- # foundRandomTD := false;
- # # For the first random pick, create a list of all development TD ordinals
- # # Subsequent random picks can remove items from the list for speed
- # if gDevLQTDHistory = {{0,0},{}}
- # begin
- # gDevLQTDHistory := {};
- # for i := 1 to gCardDevTDList #total number of development test defs
- # gDevLQTDHistory := gDevLQTDHistory + {i};
- # gDevLQTDHistory := {{0,0},gDevLQTDHistory};
- # end;
- # tdOrdinalsList := gDevLQTDHistory[2];
- # while tdOrdinalsList and not theTestDef
- # begin
- # # search until one is found or there are no more TD ordinals left to pick from
- #
- # randomIndex := random(1, card tdOrdinalsList);
- # randomOrdinal := tdOrdinalsList[randomIndex];
- #
- # # Used by the original GetLaunchQuitTD, not needed for small dev launchquits list
- # # lookupTaskIndex := 2;
- # # while randomOrdinal >= tdOrdinalSumList[lookupTaskIndex]
- # # lookupTaskIndex := lookupTaskIndex + 1;
- # # lookupTaskIndex := lookupTaskIndex - 1;
- # # theLookupTask := lookupTaskList[lookupTaskIndex][2];
- # # tdOrdInLookupTask := 1 + randomOrdinal - tdOrdinalSumList[lookupTaskIndex];
- # # lookupValue := call (theLookupTask, "thisTD", tdOrdInLookupTask, appParameters);
- #
- # ScanDevLaunchQuitTDList(TDIndexList, partialName, previousIndex, appParameters)
- # lookupValue := call (theLookupTask, "thisTD", randomOrdinal, appParameters);
- # if lookupValue
- # begin
- # theTestDef := lookupValue[2]; #ignore lookup index returned in [1]
- # if partialName = "randomDeal"
- # begin
- # tdOrdinalsList := remove(randomIndex, tdOrdinalsList);
- # end;
- # end;
- # else
- # tdOrdinalsList := remove(randomIndex, tdOrdinalsList);
- # end;
- # if theTestDef
- # gDevLQTDHistory := {{ lookupTaskIndex,tdOrdInLookupTask },tdOrdinalsList };
- # else
- # gDevLQTDHistory := {}; #reset to insure initialization next time
- # return theTestDef;
- # end; # random
- #
- # previousIndexes := gDevLQTDHistory[1];
- # stopIndex := card lookupTaskList;
- # if partialName = "nextTD" or partialName = "thisTD" or previousIndexes <> {0,0}
- # begin
- # startIndex := previousIndexes[1];
- # if not startIndex
- # startIndex := startIndex + 1;
- # end;
- # else if partialName[1] ~= /[∂≈∂?]/ # first character unknown, start search at first TD
- # startIndex := 1;
- # else
- # begin # first character known, use top level assoc
- # theLookupTask := assoc ( partialName[1], lookupTaskList );
- # if theLookupTask
- # begin
- # startIndex := isMember({ partialName[1],theLookupTask },lookupTaskList);
- # stopIndex := startIndex;
- # end;
- # else
- # startIndex := stopIndex + 1;
- # end;
- #
- # for currentIndex := startIndex to stopIndex
- # begin
- # theLookupTask := lookupTaskList[currentIndex][2];
- # lookupValue := call (theLookupTask, partialName, previousIndexes[2], appParameters);
- #
- # if lookupValue
- # begin
- # previousIndexes := { currentIndex,lookupValue[1] };
- # theTestDef := lookupValue[2];
- # stopIndex := 0;
- # end;
- # else
- # previousIndexes := {0,0};
- # end;
- # if theTestDef
- # gDevLQTDHistory := { previousIndexes,gDevLQTDHistory[2] };
- # else
- # gDevLQTDHistory := {}; #reset to insure initialization next time
- # return theTestDef;
- # end;
- #
- # ##############################################################################################
- # # task ScanDevLaunchQuitTDList(TDIndexList, partialName, previousIndex, appParameters)
- # #=============================================================================================
- # # Description: Extracts a test def using a list of test def indexes and conditions
- # # Usually only called by get_LaunchQuits_a where a is the first letter
- # # of the name of the test def. Used in three basic ways:
- # # exact name: Put the full name into partialName (including "@").
- # # This method is the fastest, it uses assoc() built-in task.
- # # partial name: Put the partial name into partialName. Put "≈" in the
- # # first character to find things in the middle of the name.
- # # Slower than exact name.
- # # this test def: Put "thisTD" into partialName and fill previousIndex with
- # # the value scanLaunchQuitTDList returned from the previous
- # # successful find. It returns the current TD.
- # # next test def: Put "nextTD" into partialName and fill previousIndex with
- # # the value scanLaunchQuitTDList returned from the previous
- # # successful find. It returns the next TD alphabetically.
- # # Parameters: partialName: string value; see above for use
- # # previousIndex: provides context for the "nextTD" case; use returnIndex
- # # value from the previous find, or zero to get the first
- # # test def in the list
- # # appParameters: return only test defs with these values in theParams (not
- # # valid for exact name method). Ignored if empty.
- # # TDIndexList: associate list; name is index and testDefTask is value
- # # Created by get_LaunchQuits_x tasks, called by GetLaunchQuitTD
- # #
- # # Returns: successful find: { returnIndex,theTestDef }
- # # unsuccessful find: { }
- # # Examples: scanLaunchQuitTDList("nextTD", prevRtnVal[1], TDIndexList) #standard "next"
- # # scanLaunchQuitTDList("TeachText 7.0@", TDIndexList) #Fast Exact Name
- # # scanLaunchQuitTDList("AppleLink", TDIndexList) #Partial Name
- # # scanLaunchQuitTDList("≈Link", TDIndexList) #Partial Name
- # # scanLaunchQuitTDList("nextTD",,{"FPU"}, TDIndexList) #First FPU-only app
- # # Assumptions: enough memory to hold it
- # #=============================================================================================
- # # History:
- # # Date: By: Changes:
- # # 08/12/93 SBR Created
- # ##############################################################################################
- # task ScanDevLaunchQuitTDList(partialName := "nextTD", previousIndex := 0, appParameters := {},
- # TDIndexList := {})
- # begin
- # returnIndex := 0;
- # theTestDef := {};
- # TDIndexQty := card TDIndexList;
- # launchParametersIndex := 5; # e.g. {"FPU"} or {"SNConflict"}
- #
- # if partialName[card partialName] = "@" # exact match is faster
- # begin
- # testDefTask := assoc(partialName, TDIndexList);
- # if testDefTask
- # begin
- # returnIndex := isMember({partialName,testDefTask},TDIndexList);
- # theTestDef := call(testDefTask);
- # fullName := partialName;
- # end;
- # end;
- # else begin
- # if partialName = "nextTD"
- # begin
- # previousIndex := previousIndex + 1;
- # partialNameScan := false;
- # end;
- # else if partialName = "thisTD"
- # begin
- # partialNameScan := false;
- # TDIndexQty := previousIndex;
- # end;
- # else
- # partialNameScan := true;
- #
- # for currentIndex := previousIndex to TDIndexQty
- # begin
- # fullName := TDIndexList[currentIndex][1];
- #
- # if partialNameScan
- # nameOK := fullName ~= /{partialName}≈/;
- # else
- # nameOK := true;
- #
- # if nameOK
- # begin
- # testDefTask := assoc(fullName, TDIndexList);
- # theTestDef := call(testDefTask);
- #
- # if appParameters
- # begin
- # launchParameters := theTestDef[launchParametersIndex];
- #
- # appParametersOK := 1;
- # for each appParameter in appParameters
- # appParametersOK := appParametersOK * isMember(appParameter,launchParameters);
- #
- # if not appParametersOK
- # theTestDef := {};
- # end;
- # end;
- #
- # if theTestDef
- # begin
- # returnIndex := currentIndex;
- # TDIndexQty := 0;
- # end;
- # end;
- # end;
- #
- # if theTestDef
- # return { returnIndex,theTestDef };
- # else
- # return { };
- # end;
-
-
-